package com.views
{
	import com.controllers.Controller;
	import com.controllers.GameController;
	
	public class GameView extends View
	{
		
		private var _ctrl:GameController;
		
		private var _gamePlayLayerView:GamePlayLayerView;
		private var _gameRandomLayerView:GameRandomLayerView;
		private var _gameUILayerView:GameUILayerView;
		public function GameView()
		{
			super();
		}
		
		override public function initView(ctrl:Controller):void{
			_ctrl = ctrl as GameController;
			init();
		}
		
		override public function createView():void{
			playLayerView.createView();
			randomLayerView.createView();
			uiLayerView.createView();
		}
		
		override public function updateView():void{
			uiLayerView.updataView();
		}
		override public function updateViewSecond():void{
			uiLayerView.updateViewSecond()
		}
		
		
		public function get playLayerView():GamePlayLayerView{
			if(!_gamePlayLayerView)_gamePlayLayerView = new GamePlayLayerView(_ctrl);
			return _gamePlayLayerView;
		}
		
		public function get randomLayerView():GameRandomLayerView{
			if(!_gameRandomLayerView)_gameRandomLayerView = new GameRandomLayerView(_ctrl);
			return _gameRandomLayerView;
		}
		public function get uiLayerView():GameUILayerView{
			if(!_gameUILayerView)_gameUILayerView = new GameUILayerView(_ctrl);
			return _gameUILayerView;
		}
		
		private function init():void{
			addChild(uiLayerView);
			addChild(randomLayerView);
			addChild(playLayerView);
			playLayerView.initView();
		}
		
	}
}